#include <stdio.h>
#include <math.h>
typedef struct
{  	   	 	 	 	 
    int year;
    int month;
    int day;
}  	   	 	 	 	  DATE;
int IsLeapYear(int y);
int DayofYear(DATE x);
int main()
{  	   	 	 	 	 
    DATE date1, date2;
    printf("Input the first date:");
    scanf("%d,%d,%d", &date1.year, &date1.month, &date1.day);
    printf("Input the second date:");
    scanf("%d,%d,%d", &date2.year, &date2.month, &date2.day);
    if (date1.year != date2.year)
    {  	   	 	 	 	 
        printf("illegal date\n");
    }
    else
    {  	   	 	 	 	 
        printf("%d\n", (int)fabs(DayofYear(date1) - DayofYear(date2)));
    }
    return 0;
}  	   	 	 	 	 
//函数功能：计算从当年1月1日起到日期d的天数，即计算日期d是当年的第几天
int DayofYear(DATE d)
{  	   	 	 	 	 
    int i, sum = 0, leap;
    int dayTab[2][13] = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
        {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
    };
    leap = IsLeapYear(d.year);
    for (i = 1; i < d.month; i++)
    {  	   	 	 	 	 
        sum = sum + dayTab[leap][i];
    }
    sum = sum + d.day;
    return sum;
}  	   	 	 	 	 
//函数功能：判断y是否是闰年，若是，则返回1，否则返回0
int IsLeapYear(int y)
{  	   	 	 	 	 
    if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
    {  	   	 	 	 	 
        return 1;
    }
    else
    {  	   	 	 	 	 
        return 0;
    }
}  	 